<template>
    <div id="tepl">
			<ul class="mui-table-view">
				<li v-for="item in list" :key="item.id" class="mui-table-view-cell mui-media">
					<router-link v-bind="{to:'/news/newsinfo/'+item.id}">
						<img class="mui-media-object mui-pull-left" :src="item.img_url">
						<div class="mui-media-body">
							{{item.title}}
							<p class='mui-ellipsis'>{{item.zhaiyao}}</p>
						</div>
                        <div class="ft"> 
                        <span>点击数：{{item.click}}</span>
                        <span id="ls">时间：{{item.add_time}}</span>
                    </div>
					</router-link>
				</li>
			</ul>
    </div>
</template>
<script>
export default {
    data(){
        return {
            list:[]
        }
    },
    created(){
        this.getnewsList();
    },
    methods:{
        getnewsList(){
           var url = '../../statics/api/news.json';
           this.$http.get(url).then(function(res){
               var body = res.body;
               if(body.status != 0){
                   alert(body.message);
                   return ;//阻断代码继续运行  ***很重要
               }
               this.list = body.message;
           })
        }
    }
}
</script>

<style scoped>
.mui-table-view img{
    width: 80px;
    height: 80px;
}
.mui-table-view .mui-media-object {
    max-width: 80px;
    line-height: 80px;
}
.ft{
    margin-top: 0.5em;
    color: aqua;
    font-size: 14px;
}
.mui-ellipsis{
    margin-top:1em;
    font-weight: bold;
}
#ls{
    margin-left: 12px;
}
</style>


